#include<iostream>
#include<queue>
#include<cmath>
using namespace std;
bool vis[10001001];
struct status
{
	int remain;
	int count;
	status(int r,int c)
	{
		remain=r;
		count=c;
	} 
};
int main()
{
	int w;
	queue<status> q;
	int weight[6]={1,2,3,5,10,20};
	cin>>w;
	status b=status(w,0);
	q.push(b);
	while(!q.empty())
	{
		status s=q.front();
		if(s.remain==0)
			break;
		if(!vis[s.count*10000+s.remain])
		{
			for(int i=0;i<6;++i) 
			{
				status t=status(abs(s.remain-weight[i]),s.count+1); 
				q.push(t);
				t=status(abs(s.remain+weight[i]),s.count+1);
				q.push(t);
			}
			vis[s.count*10000+s.remain]=true;
		}
		q.pop();
	}
	cout<<q.front().count;
	return 0;
}
